<template>
  <div>
    <div>
      <van-search v-model="value" placeholder="请输入搜索关键词" />
    </div>
    <div class="classify-box">
      <div>
        <van-sidebar v-model="activeKey">
          <van-sidebar-item
            v-for="(item, index) in typelist"
            :key="index"
            @click="chooseType(index)"
            :title="item"
          />
        </van-sidebar>
      </div>
      <div class="content">
        <Tagslist v-if="shopList" :shopList="shopList" />
        <Tagslist />
      </div>
    </div>
  </div>
</template>

<script>
import mouth from "../../../../public/utils/mouth";
import Tagslist from "../../../components/Tagslist.vue";
export default {
  name: "Menulist",
  components: {
    Tagslist,
  },
  data() {
    return {
      value: "",
      shopId: 0,
      activeKey: 0,
      shopList: [],
      typelist: ["潮款爆鞋", "人气潮服", "潮流鞋包", "潮流美妆"],
    };
  },
  methods: {
    chooseType(index) {
      this.shopId = index;
      this.listGoods();
    },

     listGoods() {
      mouth.get("/comments", {
            params:{
              kind :this.shopId
            }
        })
        .then((res) => {
          this.shopList = res.data;
          console.log(this.shopList,'父组件');
        })
        .catch((err) => {
          console.log("出错了", err);
        });
    },
    postsubmit(e){
      console.log(e);
    }
  },
   created() {
    this.listGoods();
  },
};
</script>

<style scoped>
.classify-box {
  display: flex;
}
.content {
  flex: 1;
  overflow: auto;
}
</style>